package com.yang.ddd.application.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yang.ddd.domain.picture.entity.Picture;
import com.yang.ddd.domain.user.entity.User;
import com.yang.ddd.infrastructure.api.aliyunai.model.CreateOutPaintingTaskResponse;
import com.yang.ddd.infrastructure.api.imagesearch.model.ImageSearchResult;
import com.yang.ddd.infrastructure.common.DeleteRequest;
import com.yang.ddd.interfaces.dto.picture.*;
import com.yang.ddd.interfaces.vo.picture.PictureVO;

import javax.servlet.http.HttpServletRequest;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
* @author Young
* @description 针对表【picture(图片)】的数据库操作Service
* @createDate 2025-03-25 23:25:31
*/
public interface PictureApplicationService {
    /**
     * 上传图片
     *
     * @param inputSource
     * @param pictureUploadRequest
     * @param loginUser
     * @return
     */
    PictureVO uploadPicture(Object inputSource,
                            PictureUploadRequest pictureUploadRequest,
                            User loginUser);

    /**
     * 构造查询条件
     * @param pictureQueryRequest
     * @return
     */
    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);

    /**
     * 颜色查询服务
     * @return
     */
    List<PictureVO> searchPictureByColor(SearchPictureByColorRequest searchPictureByColorRequest, HttpServletRequest request);


    void editPictureByBatch(PictureEditByBatchRequest pictureEditByBatchRequest, HttpServletRequest request);


    PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    CreateOutPaintingTaskResponse createPictureOutPaintingTask(CreatePictureOutPaintingTaskRequest createPictureOutPaintingTaskRequest, HttpServletRequest request);

    /**
     * 分页获取图片封装
     * @param picturePage
     * @param request
     * @return
     */
    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage, HttpServletRequest request);


    void checkPictureAuth(User loginUser, Picture picture);

    List<Object> selectObjs(QueryWrapper<Picture> queryWrapper);

    /**
     * 图片审核
     *
     * @param pictureReviewRequest
     */
    void doPictureReview(PictureReviewRequest pictureReviewRequest, HttpServletRequest request);


    void fillReviewParams(Picture picture, User loginUser);

    /**
     * 批量抓取和创建图片
     *
     * @param pictureUploadByBatchRequest
     * @param loginUser
     * @return 成功创建的图片数
     */
    Integer uploadPictureByBatch(
            PictureUploadByBatchRequest pictureUploadByBatchRequest,
            User loginUser);


    void deletePicture(DeleteRequest deleteRequest, HttpServletRequest request);


    void validPicture(Picture picture);

    void updatePicture(PictureUpdateRequest pictureUpdateRequest, HttpServletRequest request);


    Picture getPictureById(long id);


    PictureVO getPictureVOById(long id, HttpServletRequest request);


    Page<Picture> listPictureByPage(PictureQueryRequest pictureQueryRequest);


    Page<PictureVO> listPictureVOByPage(PictureQueryRequest pictureQueryRequest, HttpServletRequest request);


    void editPicture(PictureEditRequest pictureEditRequest, HttpServletRequest request);


    List<ImageSearchResult> searchPictureByPicture(SearchPictureByPictureRequest searchPictureByPictureRequest);


    List<Map<String, Object>> selectMaps(QueryWrapper<Picture> queryWrapper);
}
